//
// C++ Interface: activitydbinterface
//
// Description:
//
//
// Author: Willi Ballenthin <wilbal1087@gmail.com>, (C) 2008
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef ACTIVITYDBINTERFACE_H
#define ACTIVITYDBINTERFACE_H

#include "activity.h"
#include "activitystatistics.h"

#include <QtCore>
#include <QtSql>
#include <QObject>

class Activity;

/**
    @author Willi Ballenthin <wilbal1087@gmail.com>
*/
class ActivityDbInterface : public QObject
{
        Q_OBJECT
    public:
        ActivityDbInterface (QSqlDatabase* db, QObject *parent = 0 );

        void setFilter(QString filter);
        QString getFilter();
        QString getFilter(QString filter);
        QVector<Activity>*  query(QString, QVector<Activity>*);
        QVector<Activity>*  getModel();




    public slots:
        QVector<Activity>*  query();
        //HACK:
        ActivityStatistics* getStatistics();


    signals:
        // objects that edit the model should connect
        // their signals to this signal, which should
        // be connected to objects that want updates
        /// Signal that is emitted when the model has been updated.
        /// This takes place when a query to the database has taken
        /// place, or perhaps on some other edit.
        void updatedModel();

    private:
        QVector<Activity>* vector;
        QString            statement;
        //HACK:
        ActivityStatistics* stats;

        QSqlQuery* sql;
};

#endif
